package com.xtwy.admin.web.config.redis;

import org.apache.shiro.cache.Cache;
import org.apache.shiro.cache.CacheException;
import org.apache.shiro.cache.CacheManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

/**
 * 类的描述：
 *
 * @作者: 侯建军
 * @邮箱: 474177818@qq.com
 * @博客: https://blog.csdn.net/marquis888
 * @创建日期: 2018年11月18日  15:21
 * @版本: v1.0
 * @jdk版本使用: JDK1.8
 */
//@Repository("redisCacheManager")
//public class RedisShiroCacheManager implements CacheManager {
//
//    private Logger logger = LoggerFactory.getLogger(this.getClass());
//
//    private final ConcurrentMap<String, Cache> caches = new ConcurrentHashMap<String, Cache>();
//
//    @Resource
//    private RedisTemplate<String, Object> redisTemplate;
//
//    @Autowired
//    private RedisConfiguration redisConfiguration;
//
//    @Override
//    public <K, V> Cache<K, V> getCache(String name) throws CacheException {
//        logger.debug("获取名称为: " + name + " 的RedisCache实例");
//        Cache c = caches.get(name);
//
//        if(c == null){
//            c =  new RedisShiroCache<K, V>(name, redisTemplate, redisConfiguration);
//            caches.put(name, c);
//        }
//
//        return  c;
//    }
//}
//
